import { createApp } from "vue";
import "./style.css";
import App from "./App.vue";
import { createRouter, createWebHistory } from "vue-router";
import routes from "~pages";
import "./index.css";

import { store } from "@/store";
import { axiosInstance } from "@/utils/http/mineAxios";
import "@/assets/theme.css";

const router = createRouter({
  history: createWebHistory(),
  routes,
});
router.beforeEach((to, from) => {
  console.log("to的值：", to);
  console.log("from的值：", from);
  console.log("执行了全局路由钩子函数");
  return true;
});

const app = createApp(App);
app.directive("set-height", {
  mounted: function (el) {
    el.style.height = getComputedStyle(el).height;
    console.log("el.style.height", getComputedStyle(el).height);
    el.style.transition = "height 0.5s ease-in-out;";
    el.style.backgroundColor = "red";
  },
  updated: function (el) {
    // alert("updated");
    el.style.height = "auto";
    el.offsetHeight;
    el.style.height = getComputedStyle(el).height;
    console.log("getComputedStyle(el).height", getComputedStyle(el).height);
    el.style.transition = "height 0.5s ease-in-out;";
  },
});
app.use(router).use(store).mount("#app");

axiosInstance;
